21c7cc3998edd2ddf2f29124c445276c1db1ad5c,src/main/java/act/data/UrlEncodedParser.java,UrlEncodedParser,parse,#ActionContext#,23
Before Change
// We're ready to decode the params
Map<String, String[]> decodedParams = new LinkedHashMap<String, String[]>(params.size());
URLCodec codec = new URLCodec();
for (Map.Entry<String, String[]> e : params.entrySet()) {
String key = e.getKey();
try {
After Change
}
// Second phase - look for _charset_ param and do the encoding
Charset charset = Charset.forName(encoding);
if (params.containsKey("_charset_")) {
// The form contains a _charset_ param - When this is used together
// with accept-charset, we can use _charset_ to extract the encoding.
// PS: When rendering the view/form, _charset_ and accept-charset must be given the
// same value - since only Firefox and sometimes IE actually sets it when Posting
String providedCharset = params.get("_charset_")[0];
// Must be sure the providedCharset is a valid encoding..
try {
"test".getBytes(providedCharset);
charset = Charset.forName(providedCharset); // it works..
} catch (Exception e) {
logger.debug("Got invalid _charset_ in form: " + providedCharset);
// lets just use the default one..